def rotate(text, key):
    coded = ''
    for i in text:
        if i.isalpha():
            new_asc = ord(i) + key
            if ord(i) <= 90 < new_asc or new_asc > 122:
                    new_asc -= 26
            coded += chr(new_asc)
        else:
            coded += i
    return coded
